<table width="100%" cellspacing="15">
  <tr>
   <td width="80%" valign="top">
      <div class="gray_box" style="">
       <table width="100%" height="200">

        <form action="<?php echo $page_data[action_link];?>" method="POST">
        <input type="hidden" name="template_id" value="<?php echo $page_data[template][template_id];?>">
          <tr>
            <td valign="top" colspan="2"><h4>Add Template.</h4></td>
          </tr>
          <?php if ($page_data[errors] != '') {?>
            <tr>
              <td valign="top" colspan="2" style="color: #ff0000;" align="center"><?php echo implode("<br>",$page_data[errors]);?></td>
            </tr>
          <?php } // end if errors ?>
         <!-- <tr>
            <td valign="top">Project Name:</td>
            <td valign="top">
            <?php // echo menu::menu_from_assoc_array('project_id',$page_data[projectlist],$page_data[template][project_id]);?>

            <span style="color: #ff0000">*</span></td>
           </tr>
          <tr>-->
          <tr>
            <td valign="top" width="30%" >Template Name:</td>
            <td valign="top" width="70%" >  <input type="text" size="40" name="template_name" value="<?php echo $page_data[template][template_name];?>">
            <span style="color: #ff0000">*</span></td>
          </tr>
             <tr>
            <td valign="top"><strong>Body Content Start:</strong><br />
            This code will NOT be included in the body content import.  The import will begin after the last line of code defined in this textarea.
            </td>
            <td valign="top"><textarea rows="6" cols="35" name="template_start_flag" ><?php echo $page_data[template][template_start_flag];?></textarea></td>
          </tr>
          <tr>
            <td valign="top"><strong>Body Content End:</strong><br />
            This code will NOT be included in the body content import.  The import will end before the first line of code defined in this textarea.
            </td>
            <td valign="top"><textarea rows="6" cols="35" name="template_end_flag"><?php echo $page_data[template][template_end_flag];?></textarea></td>
          </tr>
       </table>
       <table width="100%" border="2">
            <tr>
               <td valign="top" colspan="2" style="align:Left">
                <strong  style="color: #ff0000;" >Joomla Module Definitions:</strong><br />
                The following code will create the Joomla Modules when this template is saved.  This code is inserted into your Joomla pages as defined by the Joomla Template.  This code is not considered on the import, but rather inserted each time Joomla renders a page.
               </td>
            </tr>
           <tr>
            <td valign="top">Module 1 Name:</td>
            <td valign="top">  <input type="text" size="40" name="module1_name" value="<?php echo $page_data[template][module1_name];?>">
           </td>
          </tr>
             <tr>
            <td valign="top">Module 1 HTML:</td>
            <td valign="top"><textarea rows="6" cols="35" name="module1_html" ><?php echo $page_data[template][module1_html];?></textarea></td>
          </tr>
           <tr>
            <td valign="top">Module 2 Name:</td>
            <td valign="top">  <input type="text" size="40" name="module2_name" value="<?php echo $page_data[template][module2_name];?>">
           </td>
          </tr>
             <tr>
            <td valign="top">Module 2 HTML:</td>
            <td valign="top"><textarea rows="6" cols="35" name="module2_html" ><?php echo $page_data[template][module2_html];?></textarea></td>
          </tr>
          <tr>
            <td valign="top">Module 3 Name:</td>
            <td valign="top">  <input type="text" size="40" name="module3_name" value="<?php echo $page_data[template][module3_name];?>">
         </td>
          </tr>
             <tr>
            <td valign="top">Module 3 HTML:</td>
            <td valign="top"><textarea rows="6" cols="35" name="module3_html" ><?php echo $page_data[template][module3_html];?></textarea></td>
          </tr>
          <tr>
            <td valign="top">Module 4 Name:</td>
            <td valign="top">  <input type="text" size="40" name="module4_name" value="<?php echo $page_data[template][module4_name];?>">
            </td>
          </tr>
             <tr>
            <td valign="top">Module 4 HTML:</td>
            <td valign="top"><textarea rows="6" cols="35" name="module4_html" ><?php echo $page_data[template][module4_html];?></textarea></td>
          </tr>
          <tr>
            <td valign="top">Module 5 Name:</td>
            <td valign="top">  <input type="text" size="40" name="module5_name" value="<?php echo $page_data[template][module5_name];?>">
            </td>
          </tr>
             <tr>
            <td valign="top">Module 5 HTML:</td>
            <td valign="top"><textarea rows="6" cols="35" name="module5_html" ><?php echo $page_data[template][module5_html];?></textarea></td>
          </tr>
            <tr>
            <td valign="top">Module 6 Name:</td>
            <td valign="top">  <input type="text" size="40" name="module6_name" value="<?php echo $page_data[template][module6_name];?>">
            </td>
          </tr>
             <tr>
            <td valign="top">Module 6 HTML:</td>
            <td valign="top"><textarea rows="6" cols="35" name="module6_html" ><?php echo $page_data[template][module6_html];?></textarea></td>
          </tr>
       </table>
       <table width="100%" border="0">
          <tr>
            <td valign="top" colspan="2" align="center">
              <input type="submit" name="submit" value="Submit">
              <input type="button" onclick="window.location='<?php echo $_SERVER['PHP_SELF'];?>'" value="Cancel">
            </td>
          </tr>
          </form>
        </table>
      </div>
    </td>
  </tr>
</table>
